const http = require("http");

// nodejs：单线程不适合做CPU密集操作的
function sleepTime(time) {
  const sleep = Date.now() + time * 1000;
  while (Date.now() < sleep) {}
  return;
}

sleepTime(4);

const server = http.createServer((req, res) => {
  res.end("server starting....");
});

server.listen(8080, () => {
  console.log("服务启动了");
});
